home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Bonus / Database / mysql-max-3.23.55.sit / mysql-max-3.23.55-apple-darwi.1 / mysql-test / t / ins000001.test < prev    next >
Encoding:
Text File  |  2003-01-21  |  383 b   |  10 lines  |  [TEXT/ttxt]

  1. use test;
  2. drop table if exists t1,t2;
  3. create table t1 (email varchar(50));
  4. insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
  5. ('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
  6. create table t2(id int not null auto_increment primary key,
  7.  t2 varchar(50), unique(t2));
  8. insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
  9. select * from t2;
  10.